<!DOCTYPE html>
<html th:lang="${language}" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
  <th:block th:include="include :: header(#{okr.my})" />
  <th:block th:include="include :: okr-css" />
</head>
<body>
<div class="col-sm-12 select-table table-striped">
  <table id="bootstrap-table"></table>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
  var prefix = ctx + "dataKanban";
  $(function(){
    var options = {
      url : prefix + "/remindScoreList",
      onDblClickRow: onDbClick,
      columns:[
        {
          field : 'userId',
          visible : false
        },
        {
          field : 'userName',
          title : [[#{okr.userName}]]
        },
        {
          field : 'scoreStatus',
          title: [[#{okr.scoreStatus}]]
        },
        {
          field : 'operation',
          title : '操作',
          formatter: function (value, row, index){0
            let actions = [];
            if (row.scoreStatus === "未打分"){
              actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="remind(' + row.userId + ')"><i class="fa fa-edit"></i>提醒员工</a> ')
            }
            return actions.join('');
          }
        }
      ]
    }
    $.table.init(options);
  })

  function remind(userId){
    console.log(userId)
    $.ajax({
      url: prefix +  "/sendRemind",
      type: 'POST',
      data: {'userId' : userId,
        'TypeId' : "score"}
    })
    $.modal.msg("通知成功", modal_status.SUCCESS)
  }

  function onDbClick(row, $element){
    $.ajax({
      url: prefix + '/getCid',
      type: 'POST',
      success: function(data){
        $.modal.openTab(row.userName + "的OKR列表",ctx + "okr/info/viewUserOkrList/"+ row.userId+"/"+data);      }
    })
  }
</script>
</body>
</html>